package org.openea.eap.module.obpm.model.form.design;

import org.openbpm.base.core.util.StringUtil;
import org.openbpm.bus.api.model.IBusTableRel;

import java.util.ArrayList;
import java.util.List;



public class FormGroup
{
  private String comment;
  private String key;
  private IBusTableRel tableRelation;
  private List<FormColumn> columnList;

  public boolean hasTitle() { return StringUtil.isNotEmpty(this.comment); }






  public List<IBusTableRel> getOne2OneChildsOne2ManyRelations() {
    List<IBusTableRel> grandson = new ArrayList<>();

    this.tableRelation.getChildren("oneToOne").forEach(one2One ->
        grandson.addAll(one2One.getChildren("oneToMany")));

    return grandson;
  }


  public String getComment() { return this.comment; }



  public void setComment(String comment) { this.comment = comment; }



  public String getKey() { return this.key; }



  public void setKey(String key) { this.key = key; }



  public List<FormColumn> getColumnList() { return this.columnList; }



  public IBusTableRel getTableRelation() { return this.tableRelation; }



  public void setTableRelation(IBusTableRel tableRelation) { this.tableRelation = tableRelation; }



  public void setColumnList(List<FormColumn> columnList) { this.columnList = columnList; }
}
